package Work;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;

// For write operation
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;


public class ViewXML {
    // Global value so it can be ref'd by the tree-adapter
    static Document document;
    ViewXML(){
    	  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();   
          try {
              File f = new File("/argumento.xml");
              DocumentBuilder builder = factory.newDocumentBuilder();
              document = builder.parse(f);

              // Use a Transformer for output
              TransformerFactory tFactory = TransformerFactory.newInstance();
              Transformer transformer = tFactory.newTransformer();
              DOMSource source = new DOMSource(document);
              StreamResult result = new StreamResult(System.out);
              transformer.transform(source, result);
          } catch (Exception e) {
  			// TODO: handle exception
  		}
    }

}